﻿using DapperExtensions;
using Nova_Common.Extend;
using Nova_DAL;
using Nova_MOD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nova_BLL
{
    public class TRelationsBll
    {
        private readonly TRelationsDal dal = new TRelationsDal();

        public TRelations GetEntityByTrayId(string trayId)
        {
            var predicate = Predicates.Field<TRelations>(t => t.Tray_ID, Operator.Eq, trayId);
            return dal.GetByField(predicate);
        }

        public bool InsertEntity(TRelations entity)
        {
            string id = dal.Insert(entity);
            return id.IsEmpty() ? false : true;
        }

        public bool UpdateEntity(TRelations entity)
        {
            return dal.Update(entity);
        }
    }
}
